# -*- coding: utf-8 -*-
"""
Created on Fri Sep 13 14:30:57 2024

@author: Unknown
"""

import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams["font.sans-serif"]=["Simhei"]
plt.rcParams["axes.unicode_minus"]=False
data1=pd.read_csv("C:\\Users\\Unknown\\Downloads\\data-china.csv",encoding='gbk')
data2=pd.read_excel("C:\\Users\\Unknown\\Downloads\\data-china.xlsx")
plt.figure(figsize=(10,5))
plt.xticks([int(data1.loc[9][0])+i for i in range(10)])
plt.yticks([i for i in range(20)])
plt.xlabel('时间')
plt.ylabel('GDP')
plt.grid(True,which='major')
plt.plot(data1['时间'],data1['GDP'],color='r',linewidth=1.5,linestyle='--',marker='o')
plt.show()

plt.figure(figsize=(10,5))
plt.scatter(data1['时间'], data1['GDP'])
plt.xticks([int(data1.loc[9][0])+i for i in range(10)])
plt.yticks([i for i in range(20)])
plt.xlabel('时间')
plt.ylabel('GDP')
plt.grid(True,which='major',linestyle='--',linewidth=1)
plt.show()

plt.figure(figsize=(10,5))
plt.bar(data1['时间'], data1['GDP'],width=0.6,color='grey')
plt.xticks([int(data1.loc[9][0])+i for i in range(10)])
plt.yticks([i for i in range(20)])
plt.xlabel('时间')
plt.ylabel('GDP')
plt.grid(True,which='major',linestyle='--',linewidth=1)
plt.show()
